Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Language Specifics in Symbol Extraction #6119

Merged
merged 2 commits into from
Nov 2, 2023

Conversation

jpbempel
Copy link
Member

@jpbempel jpbempel commented Oct 31, 2023

What Does This Do

LanguageSpecifics add specific information to symbol/scopes for Classes, methods and fields. It's relate to

  • access modifiers
  • annotations
  • super class
  • interfaces
  • return type

Motivation

Enrich the symbol extraction

Additional Notes

Jira ticket: DEBUG-1891

LanguageSpecifics add specific information to symbol/scopes
for Classes, methods and fields. It's relate to
 - access modifiers
 - annotations
 - super class
 - interfaces
 - return type
@jpbempel jpbempel requested a review from a team as a code owner October 31, 2023 08:32
@jpbempel jpbempel requested review from ojung and removed request for a team October 31, 2023 08:32
@jpbempel jpbempel added comp: debugger Dynamic Instrumentation type: enhancement labels Oct 31, 2023
@pr-commenter
Copy link

pr-commenter bot commented Oct 31, 2023

Benchmarks

Startup

Parameters

Baseline Candidate
commit 1.23.0-SNAPSHOT~205e504500 1.22.0-SNAPSHOT~f01ed6ffbb
config baseline candidate
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
module Agent Agent
parent None None
variant iast iast

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 54 cases.

Startup time reports for petclinic
gantt
    title petclinic - global startup overhead: candidate=1.22.0-SNAPSHOT~f01ed6ffbb, baseline=1.23.0-SNAPSHOT~205e504500

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.028 s) : 0, 1028389
Total [baseline] (9.358 s) : 0, 9358333
Agent [candidate] (1.038 s) : 0, 1038055
Total [candidate] (9.39 s) : 0, 9389549
section appsec
Agent [baseline] (1.118 s) : 0, 1118140
Total [baseline] (9.375 s) : 0, 9375101
Agent [candidate] (1.119 s) : 0, 1118897
Total [candidate] (9.433 s) : 0, 9432901
section iast
Agent [baseline] (1.155 s) : 0, 1155500
Total [baseline] (9.55 s) : 0, 9549704
Agent [candidate] (1.165 s) : 0, 1164856
Total [candidate] (9.54 s) : 0, 9539624
section profiling
Agent [baseline] (1.205 s) : 0, 1204754
Total [baseline] (9.581 s) : 0, 9580602
Agent [candidate] (1.206 s) : 0, 1205561
Total [candidate] (9.563 s) : 0, 9562922
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.028 s -
Agent appsec 1.118 s 89.751 ms (8.7%)
Agent iast 1.155 s 127.111 ms (12.4%)
Agent profiling 1.205 s 176.365 ms (17.1%)
Total tracing 9.358 s -
Total appsec 9.375 s 16.768 ms (0.2%)
Total iast 9.55 s 191.371 ms (2.0%)
Total profiling 9.581 s 222.269 ms (2.4%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.038 s -
Agent appsec 1.119 s 80.841 ms (7.8%)
Agent iast 1.165 s 126.801 ms (12.2%)
Agent profiling 1.206 s 167.506 ms (16.1%)
Total tracing 9.39 s -
Total appsec 9.433 s 43.352 ms (0.5%)
Total iast 9.54 s 150.075 ms (1.6%)
Total profiling 9.563 s 173.373 ms (1.8%)
gantt
    title petclinic - break down per module: candidate=1.22.0-SNAPSHOT~f01ed6ffbb, baseline=1.23.0-SNAPSHOT~205e504500

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (642.828 ms) : 0, 642828
BytebuddyAgent [candidate] (648.864 ms) : 0, 648864
GlobalTracer [baseline] (295.157 ms) : 0, 295157
GlobalTracer [candidate] (298.235 ms) : 0, 298235
AppSec [baseline] (49.078 ms) : 0, 49078
AppSec [candidate] (49.266 ms) : 0, 49266
Remote Config [baseline] (682.836 µs) : 0, 683
Remote Config [candidate] (689.27 µs) : 0, 689
Telemetry [baseline] (6.082 ms) : 0, 6082
Telemetry [candidate] (6.119 ms) : 0, 6119
section appsec
BytebuddyAgent [baseline] (643.958 ms) : 0, 643958
BytebuddyAgent [candidate] (644.024 ms) : 0, 644024
GlobalTracer [baseline] (294.224 ms) : 0, 294224
GlobalTracer [candidate] (295.426 ms) : 0, 295426
AppSec [baseline] (139.034 ms) : 0, 139034
AppSec [candidate] (138.536 ms) : 0, 138536
Remote Config [baseline] (647.636 µs) : 0, 648
Remote Config [candidate] (638.506 µs) : 0, 639
Telemetry [baseline] (5.747 ms) : 0, 5747
Telemetry [candidate] (5.756 ms) : 0, 5756
section iast
BytebuddyAgent [baseline] (773.867 ms) : 0, 773867
BytebuddyAgent [candidate] (779.504 ms) : 0, 779504
GlobalTracer [baseline] (274.736 ms) : 0, 274736
GlobalTracer [candidate] (276.608 ms) : 0, 276608
AppSec [baseline] (47.787 ms) : 0, 47787
AppSec [candidate] (48.095 ms) : 0, 48095
Remote Config [baseline] (577.719 µs) : 0, 578
Remote Config [candidate] (598.627 µs) : 0, 599
Telemetry [baseline] (8.276 ms) : 0, 8276
Telemetry [candidate] (7.714 ms) : 0, 7714
IAST [baseline] (15.64 ms) : 0, 15640
IAST [candidate] (17.484 ms) : 0, 17484
section profiling
BytebuddyAgent [baseline] (654.202 ms) : 0, 654202
BytebuddyAgent [candidate] (655.385 ms) : 0, 655385
GlobalTracer [baseline] (359.783 ms) : 0, 359783
GlobalTracer [candidate] (359.648 ms) : 0, 359648
AppSec [baseline] (49.578 ms) : 0, 49578
AppSec [candidate] (49.264 ms) : 0, 49264
Remote Config [baseline] (656.091 µs) : 0, 656
Remote Config [candidate] (658.214 µs) : 0, 658
Telemetry [baseline] (6.056 ms) : 0, 6056
Telemetry [candidate] (6.099 ms) : 0, 6099
ProfilingAgent [baseline] (81.051 ms) : 0, 81051
ProfilingAgent [candidate] (80.901 ms) : 0, 80901
Profiling [baseline] (81.075 ms) : 0, 81075
Profiling [candidate] (80.926 ms) : 0, 80926
Loading
Startup time reports for insecure-bank
gantt
    title insecure-bank - global startup overhead: candidate=1.22.0-SNAPSHOT~f01ed6ffbb, baseline=1.23.0-SNAPSHOT~205e504500

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.029 s) : 0, 1028776
Total [baseline] (8.773 s) : 0, 8773388
Agent [candidate] (1.03 s) : 0, 1030159
Total [candidate] (8.772 s) : 0, 8772459
section iast
Agent [baseline] (1.156 s) : 0, 1156252
Total [baseline] (9.289 s) : 0, 9289067
Agent [candidate] (1.163 s) : 0, 1163013
Total [candidate] (9.337 s) : 0, 9336877
section iast_TELEMETRY_OFF
Agent [baseline] (1.158 s) : 0, 1158006
Total [baseline] (9.289 s) : 0, 9289141
Agent [candidate] (1.148 s) : 0, 1147627
Total [candidate] (9.337 s) : 0, 9337372
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.029 s -
Agent iast 1.156 s 127.476 ms (12.4%)
Agent iast_TELEMETRY_OFF 1.158 s 129.229 ms (12.6%)
Total tracing 8.773 s -
Total iast 9.289 s 515.68 ms (5.9%)
Total iast_TELEMETRY_OFF 9.289 s 515.753 ms (5.9%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.03 s -
Agent iast 1.163 s 132.854 ms (12.9%)
Agent iast_TELEMETRY_OFF 1.148 s 117.468 ms (11.4%)
Total tracing 8.772 s -
Total iast 9.337 s 564.418 ms (6.4%)
Total iast_TELEMETRY_OFF 9.337 s 564.913 ms (6.4%)
gantt
    title insecure-bank - break down per module: candidate=1.22.0-SNAPSHOT~f01ed6ffbb, baseline=1.23.0-SNAPSHOT~205e504500

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (643.815 ms) : 0, 643815
BytebuddyAgent [candidate] (643.177 ms) : 0, 643177
GlobalTracer [baseline] (294.68 ms) : 0, 294680
GlobalTracer [candidate] (296.239 ms) : 0, 296239
AppSec [baseline] (48.836 ms) : 0, 48836
AppSec [candidate] (49.349 ms) : 0, 49349
Remote Config [baseline] (677.871 µs) : 0, 678
Remote Config [candidate] (683.102 µs) : 0, 683
Telemetry [baseline] (6.069 ms) : 0, 6069
Telemetry [candidate] (6.075 ms) : 0, 6075
section iast
BytebuddyAgent [baseline] (773.308 ms) : 0, 773308
BytebuddyAgent [candidate] (779.107 ms) : 0, 779107
GlobalTracer [baseline] (274.115 ms) : 0, 274115
GlobalTracer [candidate] (276.321 ms) : 0, 276321
AppSec [baseline] (47.189 ms) : 0, 47189
AppSec [candidate] (48.303 ms) : 0, 48303
IAST [baseline] (17.389 ms) : 0, 17389
IAST [candidate] (16.205 ms) : 0, 16205
Remote Config [baseline] (603.247 µs) : 0, 603
Remote Config [candidate] (598.157 µs) : 0, 598
Telemetry [baseline] (9.109 ms) : 0, 9109
Telemetry [candidate] (7.61 ms) : 0, 7610
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (774.227 ms) : 0, 774227
BytebuddyAgent [candidate] (767.699 ms) : 0, 767699
GlobalTracer [baseline] (276.346 ms) : 0, 276346
GlobalTracer [candidate] (275.573 ms) : 0, 275573
AppSec [baseline] (46.988 ms) : 0, 46988
AppSec [candidate] (46.601 ms) : 0, 46601
IAST [baseline] (16.008 ms) : 0, 16008
IAST [candidate] (15.547 ms) : 0, 15547
Remote Config [baseline] (578.051 µs) : 0, 578
Remote Config [candidate] (622.033 µs) : 0, 622
Telemetry [baseline] (8.874 ms) : 0, 8874
Telemetry [candidate] (6.954 ms) : 0, 6954
Loading

Load

Parameters

Baseline Candidate
commit 1.23.0-SNAPSHOT~205e504500 1.22.0-SNAPSHOT~f01ed6ffbb
config baseline candidate
end_time 2023-10-31T14:52:04 2023-10-31T15:08:29
start_time 2023-10-31T14:51:51 2023-10-31T15:08:16
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
variant iast iast

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 22 cases.

Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.22.0-SNAPSHOT~f01ed6ffbb, baseline=1.23.0-SNAPSHOT~205e504500
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.324 ms) : 1305, 1344
.   : milestone, 1324,
appsec (1.691 ms) : 1666, 1716
.   : milestone, 1691,
iast (1.492 ms) : 1468, 1517
.   : milestone, 1492,
profiling (1.482 ms) : 1457, 1507
.   : milestone, 1482,
tracing (1.447 ms) : 1422, 1471
.   : milestone, 1447,
section candidate
no_agent (1.337 ms) : 1318, 1356
.   : milestone, 1337,
appsec (1.693 ms) : 1669, 1718
.   : milestone, 1693,
iast (1.487 ms) : 1463, 1511
.   : milestone, 1487,
profiling (1.455 ms) : 1429, 1480
.   : milestone, 1455,
tracing (1.436 ms) : 1411, 1460
.   : milestone, 1436,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.324 ms [1.305 ms, 1.344 ms] -
appsec 1.691 ms [1.666 ms, 1.716 ms] 366.517 µs (27.7%)
iast 1.492 ms [1.468 ms, 1.517 ms] 167.752 µs (12.7%)
profiling 1.482 ms [1.457 ms, 1.507 ms] 157.37 µs (11.9%)
tracing 1.447 ms [1.422 ms, 1.471 ms] 122.151 µs (9.2%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.337 ms [1.318 ms, 1.356 ms] -
appsec 1.693 ms [1.669 ms, 1.718 ms] 356.323 µs (26.6%)
iast 1.487 ms [1.463 ms, 1.511 ms] 149.958 µs (11.2%)
profiling 1.455 ms [1.429 ms, 1.48 ms] 117.475 µs (8.8%)
tracing 1.436 ms [1.411 ms, 1.46 ms] 98.429 µs (7.4%)
Request duration reports for insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.22.0-SNAPSHOT~f01ed6ffbb, baseline=1.23.0-SNAPSHOT~205e504500
    dateFormat X
    axisFormat %s
section baseline
no_agent (364.819 µs) : 345, 384
.   : milestone, 365,
iast (462.638 µs) : 441, 484
.   : milestone, 463,
iast_FULL (531.14 µs) : 510, 552
.   : milestone, 531,
iast_INACTIVE (432.376 µs) : 411, 454
.   : milestone, 432,
iast_TELEMETRY_OFF (457.604 µs) : 437, 479
.   : milestone, 458,
tracing (434.263 µs) : 413, 455
.   : milestone, 434,
section candidate
no_agent (367.118 µs) : 346, 389
.   : milestone, 367,
iast (464.132 µs) : 443, 485
.   : milestone, 464,
iast_FULL (526.293 µs) : 505, 547
.   : milestone, 526,
iast_INACTIVE (432.283 µs) : 411, 454
.   : milestone, 432,
iast_TELEMETRY_OFF (463.395 µs) : 442, 485
.   : milestone, 463,
tracing (438.323 µs) : 417, 460
.   : milestone, 438,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 364.819 µs [345.312 µs, 384.325 µs] -
iast 462.638 µs [441.439 µs, 483.836 µs] 97.819 µs (26.8%)
iast_FULL 531.14 µs [510.428 µs, 551.853 µs] 166.321 µs (45.6%)
iast_INACTIVE 432.376 µs [410.932 µs, 453.819 µs] 67.557 µs (18.5%)
iast_TELEMETRY_OFF 457.604 µs [436.639 µs, 478.569 µs] 92.785 µs (25.4%)
tracing 434.263 µs [413.306 µs, 455.221 µs] 69.445 µs (19.0%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 367.118 µs [345.525 µs, 388.711 µs] -
iast 464.132 µs [442.848 µs, 485.415 µs] 97.013 µs (26.4%)
iast_FULL 526.293 µs [505.252 µs, 547.335 µs] 159.175 µs (43.4%)
iast_INACTIVE 432.283 µs [410.685 µs, 453.881 µs] 65.165 µs (17.8%)
iast_TELEMETRY_OFF 463.395 µs [442.204 µs, 484.587 µs] 96.277 µs (26.2%)
tracing 438.323 µs [416.593 µs, 460.053 µs] 71.205 µs (19.4%)

Copy link
Member

@ojung ojung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, thanks. Added some comments / questions.

assertLangSpecifics(
mainMethodScope.getLanguageSpecifics(),
asList("public", "static"),
asList("@com.datadog.debugger.symbol.MyAnnotation"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also get the parameter value? E.g. "class", "field" and "method"?

Copy link
Member Author

@jpbempel jpbempel Oct 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parameter values are complicated because it means we need to serialize as string the value that could be potentially be anything like a custom class from user code. so calling toString on it is problematic.
So I choose deliberately to not try to get those values.
We could revisit that to get only safe values, though, but I am not sure it's that relevant for us to get all those information right now

Object.class.getTypeName(),
asList("java.lang.annotation.Annotation"),
null);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also assert on the other fields to make sure that the access modifiers are correctly reported?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes, missed them 🤦

Object.class.getTypeName(),
null,
null);
Scope m3MethodScope = i1ClassScope.getScopes().get(0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, can we actually put a method probe in a default function today?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, in all methods having bytecode instructions

Copy link
Member

@ojung ojung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jpbempel jpbempel merged commit db79864 into master Nov 2, 2023
66 of 69 checks passed
@jpbempel jpbempel deleted the jpbempel/add-language-specifics branch November 2, 2023 20:36
@github-actions github-actions bot added this to the 1.23.0 milestone Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants